What is GitHub Pages?
GitHub Pages is a free
hosting option offered by GitHub. You can add your custom domain and GitHub provides the SSL
certificate for free as well.
1. Set up a GitHub account
To begin, sign up for a
GitHub account (if you don't already have one) at https://github.com.
Sign up for GitHub or Sign in
2. Add a new repository
Next, add a new repository
to your GitHub account.
-
Set the repository name
-
Add a description
-
Make the visibility Private
-
Add a README
Add a new repository for your website
3. Add your website files
-
Click Add file
-
Click Upload files
Add your website's files
4. Select your website files
Select all of the files and folders for your
website
5. Drag and drop your files
Drag and drop your files
into the GitHub add files dialog.
Drag and drop all of your website's file and
progress will be shown
6. Commit your files to complete the upload
-
Scroll to the bottom of the upload files page
-
Enter a commit message (ex. "Add website files")
-
Click the Commit changes button
Commit your changes to add your files
7. Go to the Settings page for your repository
On your website's
repository page, click the Settings button.
Click Settings
8. Go to Pages
On the repository settings
page, click Pages.
Click Pages
9. Set up Pages for your website
-
Select branch main
-
Click Save
Configure Pages for your website
Your site is automatically
assigned to:
https://<your github username>.github.io/<repository name>
https://<your github username>.github.io/<repository name>
Your website is now available on the internet
10. Add your custom domain
If you have your own custom
domain, go to your DNS server and configure an CNAME record for your domain (ex.
blog.example.com) and give it this value:
I use AWS so mine looks
like this.
CNAME record on AWS
11. Add your custom domain to GitHub Pages
-
Enter your custom domain
-
Click Save
Configure custom domain
-
Your website will be running at http://<your custom domain> initially.
-
You will need to wait while GitHub validates your domain then creates your SSL certificate to enable HTTPS.
12. Enable HTTPS
Once your domain is
validated, you can enable Enforce HTTPS.
Enable HTTPS only
Now your website is running
securely on https://<your custom domain>.
All done.